reqwest-middleware
A crate implementing a wrapper around reqwest to allow for client middleware chains.
This crate provides functionality for building and running middleware but no middleware implementations. This repository also contains a couple of useful concrete middleware crates:
reqwest-retry
: retry failed requests.reqwest-tracing
:tracing
integration, optional opentelemetry support.
Note about browser support: automated tests targeting wasm are disabled. The crate may work with wasm but wasm support is unmaintained. PRs improving wasm are still welcome but you'd need to reintroduce the tests and get them passing before we'd merge it (see https://github.com/TrueLayer/reqwest-middleware/pull/105).
Overview
The reqwest-middleware
client exposes the same interface as a plain reqwest
client, but
ClientBuilder
exposes functionality to attach middleware:
# Cargo.toml
# ...
[]
= "0.11"
= "0.1.6"
= "0.1.5"
= "0.2.3"
= { = "1.12.0", = ["macros", "rt-multi-thread"] }
use ;
use ;
use TracingMiddleware;
async
async
License
Third-party middleware
The following third-party middleware use reqwest-middleware
:
reqwest-conditional-middleware
- Per-request basis middlewarehttp-cache
- HTTP caching rulesreqwest-cache
- HTTP cachingaliri_reqwest
- Background token management and renewalhttp-signature-normalization-reqwest
(not free software) - HTTP Signaturesreqwest-chain
- Apply custom criteria to any reqwest response, deciding when and how to retry.